<div class="clearfix row-main" ng-controller="docCtrl">
	<div class='panel'>
		<div class="panel-heading clearfix" style="padding-bottom: 4px;padding-left:4px;" >
			<ul id='typeNav' class='nav nav-tabs pull-left'>
				<li data-type='internal' ng-class="{active:isSelected(1)}"><a href="javascript:void(0)" ng-click="changeSelected(1)"> 全部</a></li>
				<li data-type='internal' ng-class="{active:isSelected(2)}"><a href="javascript:void(0)" ng-click="changeSelected(2)">接口文档</a></li>
				<li data-type='internal' ng-class="{active:isSelected(3)}"><a href="javascript:void(0)" ng-click="changeSelected(3)">说明文档</a></li>
				
			</ul>

			<div class="panel-actions">
				<a href='javascript:void(0)'  class='btn' ng-click='init()'><i class="icon icon-refresh"></i></a>
				<form method='get' class='form-inline form-search'>
					<div class="input-group">
						<input type='text' class='form-control search-query' placeholder='请输入搜索内容' /> 
						<span class="input-group-btn"> 
							<input type='submit' class='btn' id='search' value='搜索' ng-click="init()" data-loading='稍候...' />
						</span>
					</div>
				</form>
				<a href='javascript:void(0)'  class='btn btn-primary' ui-sref="project.add({id:projectId})"><i class='icon icon-plus'></i> 添加文档</a>
			</div>
		</div>
	  <!-- 全部 -->
		<table id="data-list" class='table table-hover table-striped tablesorter' data-ng-init="init()">
			<thead>
				<tr class='text-center'>
					<th class='w-60px text-left'>&nbsp;<input type="checkbox" ng-click="checkAll($event)" />&nbsp;</th>
					<th class=''><div>所属项目</div></th>
					<th class=''><div><a class='header' data-sort='name'  ng-click='sortFun($event)' href='javascript:void(0)' >名称</a></div></th>
					<th class=''><div><a class='header' data-sort='state' ng-click='sortFun($event)' href='javascript:void(0)' >类型</a></div></th>
					<th class='w-60px'><div><a class='header' data-sort='seq' ng-click='sortFun($event)' href='javascript:void(0)' >序号</a></div></th>
					<th class='w-140px'><div><a class='header' data-sort='create_date' ng-click='sortFun($event)' href='javascript:void(0)' >时间</a></div></th>
					<th class='w-250px'>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr class='text-center' ng-repeat="doc in list" id="{{doc.id}}" ng-click='hitRow($event)' >
					<td class='text-left'>&nbsp;<input type="checkbox" ng-click="checkSelect()" />&nbsp;{{$index+1}}</td>
					<td ng-bind="doc.project_name"></td>
					<td ng-bind="doc.name"></td>
					<td>
						<label class='label label-danger' ng-if="doc.state === 0">弃用</label>
						<label class='label label-success' ng-if="doc.state === 1">接口</label>
						<label class='label label-warning' ng-if="doc.state === 2">说明文档</label>
					</td>
					<td ng-bind="doc.seq"></td>
					<td ng-bind="doc.create_date"></td>
					<td>
						<span class="dropdown">
							<a href='#' class="dropdown-toggle" data-toggle="dropdown">编辑<span class="caret"></span></a>
							<ul class="dropdown-menu pull-right text-left">
								<li ng-repeat="ver in doc.verList" >
									<a href='javascript:void(0)' class='forbider' ui-sref='project.editor({project_id:projectId,doc_id:doc.id,id:ver.id})' ng-bind='ver.version' ></a>
								</li>
							</ul>
						</span>
						&nbsp;&nbsp;
						<a href='javascript:void(0)' ng-click='del($event)'>删除</a>
						&nbsp;&nbsp;
						<span class="dropdown"> 
							<a href='#' class="dropdown-toggle" data-toggle="dropdown">工具<span class="caret"></span></a>
							<ul class="dropdown-menu pull-right text-left">
								<li>
									<a href='javascript:void(0)' class='forbider' ui-sref='project.copy({project_id:projectId,doc_id:doc.id})' >拷贝</a>
									<a href='javascript:void(0)' class='forbider' ui-sref='project.addVer({project_id:projectId,doc_id:doc.id})' >增加版本</a>
								</li>
							</ul>
						</span>
						&nbsp;&nbsp;
						<span class="dropdown">
							<a href='#' class="dropdown-toggle" data-toggle="dropdown">查看<span class="caret"></span></a>
							<ul class="dropdown-menu pull-right text-left">
								<li ng-repeat="ver in doc.verList" >
									<a href='javascript:void(0)' class='forbider' ng-click='toView(ver.id)' ng-bind='ver.version' data-toggle="modal" data-target="#viewModal" ></a>
								</li>
							</ul>
						</span>
					</td>
				</tr>
				<tr ng-if="list.length==0" >
					<td colspan="7" class="text-center">暂无数据</td>
				</tr>
			</tbody>
			<tfoot ng-if="list.length!=0" >
				<tr>
					<td colspan='14'>
						<div class='btn-group'>
							<a class='btn btn-select-all check-all' href='javascript:;' ng-click='checkAll()' >全选</a>
							<a class='btn btn-select-reverse check-inverse' href='javascript:;' ng-click='reverse()' >反选</a>
						</div>
						<input type='button' class='btn btn-primary' value='删除' data-loading='稍候...' ng-show='useBatchStatus' ng-click='del()' />
						
						<ul class="pager" style='float: right; clear: none;' >
						  <li class="previous" ng-hide='isFirst()' ng-click="isFirst() || changePage(pageNow, -1)"><a href="javascript:void(0)">«</a></li>
						  <li ng-class="{active:isCurrent(pageNum)}" ng-click="changePage(pageNum, 0)" ng-repeat="pageNum in pageNumList">
						  	<a href="javascript:void(0)" ng-bind="pageNum"><span class="sr-only" ng-show="isCurrent(pageNum)">(current)</span></a>
						  </li>
						  <li class="next" ng-hide='isLast()' ng-click="isLast() || changePage(pageNow, 1)"><a href="javascript:void(0)" aria-label="Next">»</a></li>
						</ul>
						<div style='float: right; clear: none;' class='pager'>
							共 <strong ng-bind="totalRow"></strong> 条记录，
							<div class='dropdown dropup'>
								<a href='javascript:;' data-toggle='dropdown' id='_recPerPage' data-value='10'>每页 <strong ng-bind="pageSize"></strong> 条<span class='caret'></span></a>
								<ul class='dropdown-menu  pull-right'>
									<li ng-class='{active:item===pageSize}' ng-repeat='item in pageList'><a href='javascript:void(0)' ng-bind='item' ng-click='pageSizeSelectChange(item)'></a></li>
								</ul>
							</div>
							<strong>{{pageNow}}/{{totalPage}}</strong> &nbsp;&emsp;
						</div>
					</td>
				</tr>
			</tfoot>
		</table>
	</div>
	
	<!-- 文档查看模态框 -->
	<div class="modal fade" id="viewModal">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
	        <h4 class="modal-title">文档内容</h4>
	      </div>
	      <div class="modal-body">
	     	
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	      </div>
	    </div>
	  </div>
	</div>

</div>